home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 44 / Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso / -in_the_mag- / basics / blitz / changelibnum.lha / source / changelibnum.asc
Text File  |  1997-11-26  |  852b  |  44 lines

  1. ;A small program to change blitz library numbers
  2. ;Do whatever you want with this source
  3.  
  4. usagetext$="Usage: Chlibnum <library name> <library number>"
  5.  
  6.  
  7. ;check if there were any parameters passed
  8.  
  9. pars.w=NumPars
  10.  
  11. ;print usage info and exit
  12.  
  13. If pars<2 Then NPrint usagetext$:End
  14.  
  15. ;find the parameters
  16.  
  17. filename$=Par$(1)
  18.  
  19. libnum.w=Val(Par$(2))
  20.  
  21. If filename$="?" Then NPrint usagetext$:End
  22.  
  23. errortext$="Can't open file "+"'"+filename$+"'"
  24.  
  25. ;try to open the library
  26.  
  27. If Exists(filename$)
  28.     If OpenFile(0,filename$)
  29.         FileOutput 0
  30.         FileSeek 0,37         ;jump to the right position in the file
  31.         Print Chr$(libnum)    ;print the number
  32.         DefaultOutput
  33.         CloseFile 0
  34.         Else
  35.             NPrint errortext$:End
  36.      EndIf
  37.      Else
  38.         NPrint errortext$:End
  39. EndIf
  40.  
  41. NPrint "The new library number is "+Str$(libnum)
  42. End
  43.  
  44.